package com.baofu.paycore.service.facade.enums;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.List;


/**
 * 支付工具路由配置
 * 配置支付工具大类和渠道之间的关系
 * <p>
 * </p>
 * User: Xiachen Date: 2017/3/24  Version: 1.0
 */
@Slf4j
@Getter
public enum PayToolRouteEnum {
    CLEAR_WEBPAY_ROUTE("CLEAR_WEBPAY_CHANNEL",PayToolTypeEnum.THIRD_PAY,PayToolTypeEnum.BANK_CARD),
    ACCOUNT_TRANSFER_ROUTE("ACCOUNT_TRANSFER_CHANNEL",PayToolTypeEnum.ACCOUNT),
    ;

    private String code;

    private List<PayToolTypeEnum> payToolTypeList;

    PayToolRouteEnum(String code,PayToolTypeEnum... payToolTypeEnums){
        this.code = code;
        this.payToolTypeList = Arrays.asList(payToolTypeEnums);
    }

    public boolean containsPayTool(PayToolTypeEnum payToolType){
        return payToolTypeList.contains(payToolType);
    }

    public boolean containsPayTool(String payToolType){
        try{
            return containsPayTool(PayToolTypeEnum.valueOf(payToolType));
        }catch (Exception e){
            return false;
        }
    }
}
